<div class='center_form'>
    <div class="center_form_right">
        <div class='center_form_btn_div' onclick='javascript:Common.submit();'>
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/save.gif'/>
            </div><div class='center_form_btn_text'><?php echo $this->translate("saveBtn"); ?></div>
        </div>
        <?php
        if(AAService::isAllowed("metadata", "delete")){
        ?>
        <div class='center_form_btn_div' onclick='javascript:Common.gotoUrl("<?php echo HttpUtil::baseUrl();?>/metadata/metadata/delete/id/<?php echo $this->id;?>")'>
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/delete.gif'/>
            </div><div class='center_form_btn_text'><?php echo $this->translate("delBtn");?></div>
        </div>
        <?php }?>   
        <div class='center_form_btn_div' onclick='javascript:Common.gotoUrl("<?php echo HttpUtil::baseUrl();?>/metadata/metadata");'>
            <div class='center_form_btn_pic'>
                <img src='<?php echo HttpUtil::baseUrl();?>/images/cancel.gif'/>
            </div><div class='center_form_btn_text'><?php echo $this->translate("cancelBtn"); ?></div>
        </div>
    </div>
</div>
<div class="clear"></div>
<div class="centerbig_form">
      <input type="hidden" value="<?php echo $this->translate("defaultValueLabel"); ?>" id="defaultValueLabel" />
      <input type="hidden" value="<?php echo $this->translate("remove"); ?>" id="removeBtn" />
      <div class="center_top"><span class="center_top_title"><?php echo $this->translate("editMetadata"); ?></span></div>
      <div class="right_form_content">
            <div class="centerbig_right">
               <div class="form_content">
                    <form action="<?php echo $this->form->getAction(); ?>" method="post">
                        <?php ZendFormUtil::renderHiddenElement($this->form->id); ?>
                        <?php ZendFormUtil::renderHiddenElement($this->form->inputTypeValue); ?>
                        <?php ZendFormUtil::renderElement($this->form->code,array("style"=>"width:150px")); ?>
                        <?php ZendFormUtil::renderElement($this->form->title,array("style"=>"width:150px")); ?>
                        <?php ZendFormUtil::renderElement($this->form->longTitle,array("style"=>"width:150px")); ?>
                        <?php ZendFormUtil::renderElement($this->form->sortOrder,array("style"=>"width:150px")); ?>
                        <?php ZendFormUtil::renderElement($this->form->inputType,array("style"=>"width:150px")); ?>
                        <div id="defaultValueDiv">
                            <?php if($this->metadata['input_type'] == 1){
                            ?>
                                <div class="form_line_div">
                                    <div class="form_element_label" style="width:150px;"><?php echo $this->translate("defaultValueLabel"); ?></div>
                                    <div class="form_element">
                                      <input type='text' name='defaultValue' value='<?php echo $this->metadata["default_value"]; ?>' />
                                    </div>
                                </div>
                                <div class="clear"></div>
                            <?php
                            }
                            ?>
                            <?php if($this->metadata['input_type'] == 2){
                            ?>
                                <div class="form_line_div">
                                    <div class="form_element_label" style="width:150px;"><?php echo $this->translate("defaultValueLabel"); ?></div>
                                    <div class="form_element">
                                        <textarea cols="35" rows="7" name="defaultValue"><?php echo trim($this->metadata['default_value']);?></textarea>
                                    </div>
                                </div>
                                <div class="clear"></div>
                            <?php
                            }
                            ?>
                        </div>
                        <?php ZendFormUtil::renderElement($this->form->valueRequired,array("style"=>"width:150px")); ?>
                        <?php ZendFormUtil::renderElement($this->form->inBasicSearch,array("style"=>"width:150px")); ?>
                        <?php ZendFormUtil::renderElement($this->form->inAdvanceSearch,array("style"=>"width:150px")); ?>
                        <?php ZendFormUtil::renderElement($this->form->showInProduct,array("style"=>"width:150px")); ?>
                        <?php
                            if(($this->metadata['input_type'] == 3 || $this->metadata['input_type'] == 4) && !empty($this->metadataOption)){
                                
                        ?>
                        <div id="metadataOptionDiv">
                            <div class="form_line_div">
                                  <div class="form_element_label" style="width:150px;">
                                        <?php echo $this->translate("metadataOptionMsg"); ?>
                                  </div>
                                  <div class="form_element">
                                      <input type="hidden" value="<?php echo sizeof($this->metadataOption); ?>" id="optionCount" />
                                        <table class="form_element_table" cellspacing="0" cellpadding="0" style="margin-top: 5px; margin-left: 2px;margin-bottom: 25px;">
                                            <thead>
                                                <tr>
                                                    <td class="dbgrid_th2">
                                                        <span><?php echo $this->translate("optionValue"); ?></span>
                                                    </td>
                                                    <td class="dbgrid_th2">
                                                        <span><?php echo $this->translate("optionTitle"); ?></span>
                                                    </td>
                                                    <td class="dbgrid_th2">
                                                        <span><?php echo $this->translate("optionOrder"); ?></span>
                                                    </td>
                                                    <td class="dbgrid_th2">
                                                        <input type="button" value="<?php echo $this->translate("addNewOption"); ?>" onclick="javascript:Metadata.addOption();" />
                                                    </td>
                                                </tr>
                                            </thead>
                                            <tbody id="metadataOptionBody">
                                                <?php
                                                    $i = 0;
                                                    foreach($this->metadataOption as $option){
                                                ?>
                                                    <tr id='itemRow<?php echo $i;?>'>
                                                        <td class='dbgrid_td'>
                                                            <input type='text' name='optionValue[]' style='width:180px;' value='<?php echo $option["value"] ;?>' />
                                                        </td>
                                                        <td class='dbgrid_td'>
                                                            <input type='text' name='optionTitle[]' style='width:180px;' value='<?php echo $option["title"] ;?>' />
                                                        </td>
                                                        <td class='dbgrid_td'>
                                                            <input type='text' name='optionOrder[]' style='width:40px;' value='<?php echo $option["sort_order"] ;?>' />
                                                        </td>
                                                        <td class='dbgrid_td'>
                                                            <input type='button' value='<?php echo $this->translate("remove"); ?>' onclick='javascript:Metadata.removeOption("itemRow<?php echo $i; ?>");' />
                                                        </td>
                                                    </tr>
                                                <?php
                                                    $i++;
                                                 }
                                                ?>
                                            </tbody>
                                        </table>
                                  </div>
                            </div>
                        </div>
                        <?php
                            }
                        ?>
                    </form>
               </div>
            </div>
      </div>
      <div class='clear'></div>
</div>
<div class='clear'></div>